package com.ssy.lingxi.system.controller;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.PageModel;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.system.dto.request.MemberPromotionRuleUpdateRequest;
import com.ssy.lingxi.system.dto.response.MemberPromotionRuleResponse;
import com.ssy.lingxi.system.service.MemberPromotionRuleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @menu 会员设置-会员升级规则设置管理
 * @author wrc
 * @date 2020/7/20
 */
@RestController
public class MemberPromotionRuleController {


    @Resource
    MemberPromotionRuleService memberPromotionRuleService;

    /**
     * 会员升级规则列表
     * @param request 接口参数
     * @return 查询结果
     */
    @GetMapping("/member/promotion/rule/list")
    public Wrapper<PageData<MemberPromotionRuleResponse>> memberPromotionRuleList(PageModel request) {
        return memberPromotionRuleService.memberPromotionRuleList(request);
    }

    /**
     * 会员升级规则启用、停用
     * @param request 接口参数
     * @return 操作结果
     */
    @PostMapping("/member/promotion/rule/update")
    public Wrapper<Void> memberPromotionRuleUpdate(@RequestBody MemberPromotionRuleUpdateRequest request) {
        return memberPromotionRuleService.memberPromotionRuleUpdate(request);
    }

}
